"""客户关怀页面"""
from page.base_page import BasePage
from selenium.webdriver.common.by import By


class CustomCarePage(BasePage):
    url = '/crm5/index.php?m=customer&a=cares'

    #定位器
    # 点击查看
    contact_care_look_locator = (By.CSS_SELECTOR,
                                 '#form1 > table > tbody > tr:nth-child(1) > td:nth-child(7) > a:nth-child(1)')

    #新建客户关怀
    customer_care_locator = (By.XPATH,'/html/body/div[5]/div[2]/div[1]/div/a/i')
    #客户关怀添加成功
    care_success_tip_locator = (By.XPATH,'/html/body/div[5]/div[2]')

    def click_look(self):
        """点击查看"""
        self.driver.find_element(*self.contact_care_look_locator).click()

    def click_new_custom_care(self):
        """点击新建客户关怀"""
        self.driver.find_element(*self.customer_care_locator).click()

    def get_care_success_tip(self):
        """获取客户关怀添加成功文本"""
        return self.driver.find_element(*self.care_success_tip_locator).text
